package com.heima.controller;

import com.heima.model.vos.Result;
import com.heima.model.wemedia.dtos.WmNewsDto;
import com.heima.service.WmNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author itheima
 * @since 2023-01-03
 */
@RestController
@RequestMapping("/api/v1/news")
public class NewsController {

    @Autowired
    private WmNewsService wmNewsService;

    @PostMapping("/submit")
    public Result submitNews(@RequestBody WmNewsDto wmNewsDto) throws Exception {
        return Result.success(wmNewsService.submitNews(wmNewsDto));
    }

}
